﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BG.Memberships.Context;
using BG.Memberships.Model;

namespace BG.DAL.SQLDAL
{
    public class MemberShipManager
    {
        //return true = User can register
        public static bool IsAvailableUser(string text)
        {
            if (String.IsNullOrEmpty(text))
                return false;

            using (DataContext db = new DataContext())
            {
                User user = db.Users.Where(m => m.Username == text).SingleOrDefault();
                if (user == null)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
    }
}
